﻿/**
 * Copyright (c) 2008 michiyasu wada
 * http://www.seyself.com/
 * 
 * Distributed under The MIT License.
 * [http://www.opensource.org/licenses/mit-license.php]
 */

package demo.scenes
{
import demo.objects.BodyCast;
import demo.objects.HeaderCast;
import demo.objects.MainCast;
import flash.events.Event;
import jp.progression.casts.CastSprite;
import jp.progression.commands.AddChild;
import jp.progression.commands.RemoveChild;
import jp.progression.events.SceneEvent;
import jp.progression.scenes.SceneObject;
import jp.progression.Progression;

import demo.objects.items.AboutCast;
import demo.objects.items.TermsCast;
import demo.objects.items.PrivacyCast;

public class Main extends SceneObject
{
    
    //--------------------------------------------------------------------------
    //  Properties
    //--------------------------------------------------------------------------
    private static var _instance:Main;
    public static function get instance():Main
    {
        return _instance;
    }
    
    private static var _cast:MainCast;
    public static function get cast():MainCast
    {
        return _cast;
    }
    
    //--------------------------------------------------------------------------
    //  Constructor
    //--------------------------------------------------------------------------
    public function Main(name:String) 
    {
        super(name);
        title = "Progression de Amazon";
        
        _instance = this;
        _cast = new MainCast();
    }
    
    
    //--------------------------------------------------------------------------
    //  Override Methods
    //--------------------------------------------------------------------------
    override protected function _onSceneAdded():void
    {
        addChild( new SearchScene("search") );
        addChild( new SubPageScene("about"  , "このサイトについて｜"   + title , AboutCast   ) );
        addChild( new SubPageScene("terms"  , "ご利用規約｜"      + title , TermsCast   ) );
        addChild( new SubPageScene("privacy", "プライバシーポリシー｜" + title , PrivacyCast ) );
    }
    
    override protected function _onLoad():void
    {
        if (DemoPreloader.status != "close") DemoPreloader.status = "skip";
        
        addCommand( 
            new AddChild( progression.container , _cast )
        );
    }
    
    override protected function _onGoto():void
    {
        addCommand( 
            new RemoveChild( progression.container , _cast )
        );
    }
    
}

}